<?php

class vieworder extends page
{	  
	var $body_tpl = "page_templates/vieworder.tpl";
	
  	
	function page_do()
	{
		parent::page_do();
		   		   
	
		if (@$_REQUEST['submit'] == "View")
		{
			Ice_loadProfile();
			global $config;
			global $ICE;

			$proxy = $ICE->stringToProxy($config['CS430 Integration']['crm orb locator']);

			$crm = $proxy->ice_checkedCast("::CustomerRelationsManagement::CRM");
			
			$order = $crm->LoadOrderById(intval(@$_REQUEST['ordernum']));
			
			
			$dl = $order->getDeadline();
			$arr = array(
				$order->getId(),
				$order->getCustomer(),
				$order->getSrc(),
				$order->getDst(),
				$order->getWeight(),
				$dl->year . "-" . $dl->month . "-" . $dl->day,
				($order->getStatus() == CustomerRelationsManagement_OrderStatus::DELIVERED?"Delivered":"Open")
			);
			
			
			@$this->body->assign_var('data', "<tr><td>" . implode("</td><td>", $arr) . "</td></tr>");

		}
				
	}	  
}

?>